import State from '../Base/State'
import { StateMachine } from './StateMachine'

/**
 * Predefined variables
 * Name = StateMachine
 * DateTime = Sat Jul 09 2022 20:20:36 GMT+0800 (中国标准时间)
 * Author = Zero_Y
 * FileBasename = StateMachine.ts
 * FileBasenameNoExtension = StateMachine
 * URL = db://assets/Scripts/Base/StateMachine.ts
 * ManualUrl = https://docs.cocos.com/creator/3.4/manual/zh/
 *
 */

export abstract class SubStateMachine {
  constructor(public fsm: StateMachine) {}
  // 当前选中的动画
  private _currentState: State = null
  // 状态机列表
  stateMachines: Map<string, State> = new Map()

  get currentState() {
    return this._currentState
  }

  set currentState(newState) {
    this._currentState = newState
    this._currentState.run()
  }

  abstract run(): void
}
